\(\int (a+b \cot ^2(x))^{3/2} \tan (x) \, dx\) [29]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F(-2)]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 75 \[ \int \left (a+b \cot ^2(x)\right )^{3/2} \tan (x) \, dx=a^{3/2} \text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-(a-b)^{3/2} \text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )-b \sqrt {a+b \cot ^2(x)} \]

[Out]

a^(3/2)*arctanh((a+b*cot(x)^2)^(1/2)/a^(1/2))-(a-b)^(3/2)*arctanh((a+b*cot(x)^2)^(1/2)/(a-b)^(1/2))-b*(a+b*cot
(x)^2)^(1/2)

Rubi [A] (verified)

Time = 0.14 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {3751, 457, 86, 162, 65, 214} \[ \int \left (a+b \cot ^2(x)\right )^{3/2} \tan (x) \, dx=a^{3/2} \text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-(a-b)^{3/2} \text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )-b \sqrt {a+b \cot ^2(x)} \]

[In]

Int[(a + b*Cot[x]^2)^(3/2)*Tan[x],x]

[Out]

a^(3/2)*ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a]] - (a - b)^(3/2)*ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a - b]] - b*Sq
rt[a + b*Cot[x]^2]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 86

Int[((e_.) + (f_.)*(x_))^(p_)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Simp[f*((e + f*x)^(p -
 1)/(b*d*(p - 1))), x] + Dist[1/(b*d), Int[(b*d*e^2 - a*c*f^2 + f*(2*b*d*e - b*c*f - a*d*f)*x)*((e + f*x)^(p -
 2)/((a + b*x)*(c + d*x))), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && GtQ[p, 1]

Rule 162

Int[(((e_.) + (f_.)*(x_))^(p_)*((g_.) + (h_.)*(x_)))/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :>
 Dist[(b*g - a*h)/(b*c - a*d), Int[(e + f*x)^p/(a + b*x), x], x] - Dist[(d*g - c*h)/(b*c - a*d), Int[(e + f*x)
^p/(c + d*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, h}, x]

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {\left (a+b x^2\right )^{3/2}}{x \left (1+x^2\right )} \, dx,x,\cot (x)\right ) \\ & = -\left (\frac {1}{2} \text {Subst}\left (\int \frac {(a+b x)^{3/2}}{x (1+x)} \, dx,x,\cot ^2(x)\right )\right ) \\ & = -b \sqrt {a+b \cot ^2(x)}-\frac {1}{2} \text {Subst}\left (\int \frac {a^2+(2 a-b) b x}{x (1+x) \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right ) \\ & = -b \sqrt {a+b \cot ^2(x)}-\frac {1}{2} a^2 \text {Subst}\left (\int \frac {1}{x \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right )+\frac {1}{2} (a-b)^2 \text {Subst}\left (\int \frac {1}{(1+x) \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right ) \\ & = -b \sqrt {a+b \cot ^2(x)}-\frac {a^2 \text {Subst}\left (\int \frac {1}{-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \cot ^2(x)}\right )}{b}+\frac {(a-b)^2 \text {Subst}\left (\int \frac {1}{1-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \cot ^2(x)}\right )}{b} \\ & = a^{3/2} \text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-(a-b)^{3/2} \text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )-b \sqrt {a+b \cot ^2(x)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.09 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.00 \[ \int \left (a+b \cot ^2(x)\right )^{3/2} \tan (x) \, dx=a^{3/2} \text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-(a-b)^{3/2} \text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )-b \sqrt {a+b \cot ^2(x)} \]

[In]

Integrate[(a + b*Cot[x]^2)^(3/2)*Tan[x],x]

[Out]

a^(3/2)*ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a]] - (a - b)^(3/2)*ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a - b]] - b*Sq
rt[a + b*Cot[x]^2]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(340\) vs. \(2(61)=122\).

Time = 1.28 (sec) , antiderivative size = 341, normalized size of antiderivative = 4.55

method result size
default \(\frac {\sqrt {4}\, \left (\cos \left (x \right )-1\right ) \left (a +b \cot \left (x \right )^{2}\right )^{\frac {3}{2}} \left (a^{\frac {3}{2}} \sqrt {-a +b}\, \operatorname {arctanh}\left (\frac {\sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \left (\cot \left (x \right )+\csc \left (x \right )\right )}{\sqrt {a}}\right ) \sin \left (x \right )-\cos \left (x \right ) \sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \sqrt {-a +b}\, b +\arctan \left (\frac {\sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \left (\cot \left (x \right )+\csc \left (x \right )\right )}{\sqrt {-a +b}}\right ) a^{2} \sin \left (x \right )-2 \arctan \left (\frac {\sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \left (\cot \left (x \right )+\csc \left (x \right )\right )}{\sqrt {-a +b}}\right ) a b \sin \left (x \right )+\arctan \left (\frac {\sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \left (\cot \left (x \right )+\csc \left (x \right )\right )}{\sqrt {-a +b}}\right ) b^{2} \sin \left (x \right )-\sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \sqrt {-a +b}\, b \right )}{2 \sqrt {-a +b}\, \left (a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a \right ) \sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}}\) \(341\)

[In]

int((a+b*cot(x)^2)^(3/2)*tan(x),x,method=_RETURNVERBOSE)

[Out]

1/2*4^(1/2)/(-a+b)^(1/2)*(cos(x)-1)*(a+b*cot(x)^2)^(3/2)*(a^(3/2)*(-a+b)^(1/2)*arctanh(1/a^(1/2)*(-(a*cos(x)^2
-cos(x)^2*b-a)/(cos(x)+1)^2)^(1/2)*(cot(x)+csc(x)))*sin(x)-cos(x)*(-(a*cos(x)^2-cos(x)^2*b-a)/(cos(x)+1)^2)^(1
/2)*(-a+b)^(1/2)*b+arctan(1/(-a+b)^(1/2)*(-(a*cos(x)^2-cos(x)^2*b-a)/(cos(x)+1)^2)^(1/2)*(cot(x)+csc(x)))*a^2*
sin(x)-2*arctan(1/(-a+b)^(1/2)*(-(a*cos(x)^2-cos(x)^2*b-a)/(cos(x)+1)^2)^(1/2)*(cot(x)+csc(x)))*a*b*sin(x)+arc
tan(1/(-a+b)^(1/2)*(-(a*cos(x)^2-cos(x)^2*b-a)/(cos(x)+1)^2)^(1/2)*(cot(x)+csc(x)))*b^2*sin(x)-(-(a*cos(x)^2-c
os(x)^2*b-a)/(cos(x)+1)^2)^(1/2)*(-a+b)^(1/2)*b)/(a*cos(x)^2-cos(x)^2*b-a)/(-(a*cos(x)^2-cos(x)^2*b-a)/(cos(x)
+1)^2)^(1/2)

Fricas [A] (verification not implemented)

none

Time = 0.79 (sec) , antiderivative size = 565, normalized size of antiderivative = 7.53 \[ \int \left (a+b \cot ^2(x)\right )^{3/2} \tan (x) \, dx=\left [\frac {1}{2} \, a^{\frac {3}{2}} \log \left (2 \, a \tan \left (x\right )^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b\right ) - \frac {1}{4} \, {\left (a - b\right )}^{\frac {3}{2}} \log \left (-\frac {{\left (8 \, a^{2} - 8 \, a b + b^{2}\right )} \tan \left (x\right )^{4} + 2 \, {\left (4 \, a b - 3 \, b^{2}\right )} \tan \left (x\right )^{2} + b^{2} + 4 \, {\left ({\left (2 \, a - b\right )} \tan \left (x\right )^{4} + b \tan \left (x\right )^{2}\right )} \sqrt {a - b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{\tan \left (x\right )^{4} + 2 \, \tan \left (x\right )^{2} + 1}\right ) - b \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}, -\sqrt {-a} a \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2}}{a \tan \left (x\right )^{2} + b}\right ) - \frac {1}{4} \, {\left (a - b\right )}^{\frac {3}{2}} \log \left (-\frac {{\left (8 \, a^{2} - 8 \, a b + b^{2}\right )} \tan \left (x\right )^{4} + 2 \, {\left (4 \, a b - 3 \, b^{2}\right )} \tan \left (x\right )^{2} + b^{2} + 4 \, {\left ({\left (2 \, a - b\right )} \tan \left (x\right )^{4} + b \tan \left (x\right )^{2}\right )} \sqrt {a - b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{\tan \left (x\right )^{4} + 2 \, \tan \left (x\right )^{2} + 1}\right ) - b \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}, \frac {1}{2} \, {\left (-a + b\right )}^{\frac {3}{2}} \arctan \left (-\frac {2 \, \sqrt {-a + b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2}}{{\left (2 \, a - b\right )} \tan \left (x\right )^{2} + b}\right ) + \frac {1}{2} \, a^{\frac {3}{2}} \log \left (2 \, a \tan \left (x\right )^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b\right ) - b \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}, -\sqrt {-a} a \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2}}{a \tan \left (x\right )^{2} + b}\right ) + \frac {1}{2} \, {\left (-a + b\right )}^{\frac {3}{2}} \arctan \left (-\frac {2 \, \sqrt {-a + b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2}}{{\left (2 \, a - b\right )} \tan \left (x\right )^{2} + b}\right ) - b \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}\right ] \]

[In]

integrate((a+b*cot(x)^2)^(3/2)*tan(x),x, algorithm="fricas")

[Out]

[1/2*a^(3/2)*log(2*a*tan(x)^2 + 2*sqrt(a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b) - 1/4*(a - b)^(3/2)*lo
g(-((8*a^2 - 8*a*b + b^2)*tan(x)^4 + 2*(4*a*b - 3*b^2)*tan(x)^2 + b^2 + 4*((2*a - b)*tan(x)^4 + b*tan(x)^2)*sq
rt(a - b)*sqrt((a*tan(x)^2 + b)/tan(x)^2))/(tan(x)^4 + 2*tan(x)^2 + 1)) - b*sqrt((a*tan(x)^2 + b)/tan(x)^2), -
sqrt(-a)*a*arctan(sqrt(-a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2/(a*tan(x)^2 + b)) - 1/4*(a - b)^(3/2)*log(
-((8*a^2 - 8*a*b + b^2)*tan(x)^4 + 2*(4*a*b - 3*b^2)*tan(x)^2 + b^2 + 4*((2*a - b)*tan(x)^4 + b*tan(x)^2)*sqrt
(a - b)*sqrt((a*tan(x)^2 + b)/tan(x)^2))/(tan(x)^4 + 2*tan(x)^2 + 1)) - b*sqrt((a*tan(x)^2 + b)/tan(x)^2), 1/2
*(-a + b)^(3/2)*arctan(-2*sqrt(-a + b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2/((2*a - b)*tan(x)^2 + b)) + 1/
2*a^(3/2)*log(2*a*tan(x)^2 + 2*sqrt(a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b) - b*sqrt((a*tan(x)^2 + b)
/tan(x)^2), -sqrt(-a)*a*arctan(sqrt(-a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2/(a*tan(x)^2 + b)) + 1/2*(-a +
 b)^(3/2)*arctan(-2*sqrt(-a + b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2/((2*a - b)*tan(x)^2 + b)) - b*sqrt((
a*tan(x)^2 + b)/tan(x)^2)]

Sympy [F]

\[ \int \left (a+b \cot ^2(x)\right )^{3/2} \tan (x) \, dx=\int \left (a + b \cot ^{2}{\left (x \right )}\right )^{\frac {3}{2}} \tan {\left (x \right )}\, dx \]

[In]

integrate((a+b*cot(x)**2)**(3/2)*tan(x),x)

[Out]

Integral((a + b*cot(x)**2)**(3/2)*tan(x), x)

Maxima [F]

\[ \int \left (a+b \cot ^2(x)\right )^{3/2} \tan (x) \, dx=\int { {\left (b \cot \left (x\right )^{2} + a\right )}^{\frac {3}{2}} \tan \left (x\right ) \,d x } \]

[In]

integrate((a+b*cot(x)^2)^(3/2)*tan(x),x, algorithm="maxima")

[Out]

integrate((b*cot(x)^2 + a)^(3/2)*tan(x), x)

Giac [F(-2)]

Exception generated. \[ \int \left (a+b \cot ^2(x)\right )^{3/2} \tan (x) \, dx=\text {Exception raised: TypeError} \]

[In]

integrate((a+b*cot(x)^2)^(3/2)*tan(x),x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:sym2poly/r2sym(const gen & e,const index_m & i,const vecteur & l) Error: Bad Argument Value

Mupad [B] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 506, normalized size of antiderivative = 6.75 \[ \int \left (a+b \cot ^2(x)\right )^{3/2} \tan (x) \, dx=\mathrm {atanh}\left (\frac {2\,b^6\,\sqrt {a^3}\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{-6\,a^5\,b^3+12\,a^4\,b^4-8\,a^3\,b^5+2\,a^2\,b^6}-\frac {8\,a\,b^5\,\sqrt {a^3}\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{-6\,a^5\,b^3+12\,a^4\,b^4-8\,a^3\,b^5+2\,a^2\,b^6}+\frac {12\,a^2\,b^4\,\sqrt {a^3}\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{-6\,a^5\,b^3+12\,a^4\,b^4-8\,a^3\,b^5+2\,a^2\,b^6}-\frac {6\,a^3\,b^3\,\sqrt {a^3}\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{-6\,a^5\,b^3+12\,a^4\,b^4-8\,a^3\,b^5+2\,a^2\,b^6}\right )\,\sqrt {a^3}-\mathrm {atanh}\left (\frac {2\,a\,b^5\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}\,\sqrt {a^3-3\,a^2\,b+3\,a\,b^2-b^3}}{6\,a^5\,b^3-18\,a^4\,b^4+20\,a^3\,b^5-10\,a^2\,b^6+2\,a\,b^7}-\frac {6\,a^2\,b^4\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}\,\sqrt {a^3-3\,a^2\,b+3\,a\,b^2-b^3}}{6\,a^5\,b^3-18\,a^4\,b^4+20\,a^3\,b^5-10\,a^2\,b^6+2\,a\,b^7}+\frac {6\,a^3\,b^3\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}\,\sqrt {a^3-3\,a^2\,b+3\,a\,b^2-b^3}}{6\,a^5\,b^3-18\,a^4\,b^4+20\,a^3\,b^5-10\,a^2\,b^6+2\,a\,b^7}\right )\,\sqrt {{\left (a-b\right )}^3}-b\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}} \]

[In]

int(tan(x)*(a + b*cot(x)^2)^(3/2),x)

[Out]

atanh((2*b^6*(a^3)^(1/2)*(a + b/tan(x)^2)^(1/2))/(2*a^2*b^6 - 8*a^3*b^5 + 12*a^4*b^4 - 6*a^5*b^3) - (8*a*b^5*(
a^3)^(1/2)*(a + b/tan(x)^2)^(1/2))/(2*a^2*b^6 - 8*a^3*b^5 + 12*a^4*b^4 - 6*a^5*b^3) + (12*a^2*b^4*(a^3)^(1/2)*
(a + b/tan(x)^2)^(1/2))/(2*a^2*b^6 - 8*a^3*b^5 + 12*a^4*b^4 - 6*a^5*b^3) - (6*a^3*b^3*(a^3)^(1/2)*(a + b/tan(x
)^2)^(1/2))/(2*a^2*b^6 - 8*a^3*b^5 + 12*a^4*b^4 - 6*a^5*b^3))*(a^3)^(1/2) - atanh((2*a*b^5*(a + b/tan(x)^2)^(1
/2)*(3*a*b^2 - 3*a^2*b + a^3 - b^3)^(1/2))/(2*a*b^7 - 10*a^2*b^6 + 20*a^3*b^5 - 18*a^4*b^4 + 6*a^5*b^3) - (6*a
^2*b^4*(a + b/tan(x)^2)^(1/2)*(3*a*b^2 - 3*a^2*b + a^3 - b^3)^(1/2))/(2*a*b^7 - 10*a^2*b^6 + 20*a^3*b^5 - 18*a
^4*b^4 + 6*a^5*b^3) + (6*a^3*b^3*(a + b/tan(x)^2)^(1/2)*(3*a*b^2 - 3*a^2*b + a^3 - b^3)^(1/2))/(2*a*b^7 - 10*a
^2*b^6 + 20*a^3*b^5 - 18*a^4*b^4 + 6*a^5*b^3))*((a - b)^3)^(1/2) - b*(a + b/tan(x)^2)^(1/2)